<template>
<view>
<view class="notice-warp">
  <view class="notice">
    <text>拼团须知：</text>
  </view>
  <view class="notice-cont">
    <text>好友拼团，人满发货，人不满退款</text>
  </view>
</view>
<view class="goods-warp">
  <view class="goods-pic">
    <image :src="goods.goods_img"></image>
  </view>
  <view class="goods-cont fr">
    <view class="goods-title">
      <text>{{goods.goods_name}}</text>
    </view>
    <view class="goods-spec">
      <text>{{tzname}}发起的拼团</text>
    </view>
    <view class="goods-price">
      <text>￥</text>
      <text>{{goods.price}}</text>
    </view>
    <view class="goods-people">
      <text>{{group_need_num}}人团</text>
    </view>
  </view>
</view>
<view class="people-cont">
  <view class="terminate-warp">
    <image src="/static/remao_shop/img/left.png"></image>
    <view class="terminate-left">
      恭喜！
      <text>拼团成功！</text>
    </view>
    <image src="/static/remao_shop/img/right.png"></image>
  </view>
  <view class="people-warp">
    <view class="people">
        <view class="colonel-warp">
        <image :src="tzimg"></image>
        <view class="colonel">团长</view>
      </view>
      <text>{{tzname}}</text>
    </view>
    <view v-for="(item, index) in ty" :key="index" class="people">
      <image :src="item.avatar"></image>
      <text>{{item.nickname}}</text>
    </view>
    <!-- <view class='nopeople'>
        <image></image>
        <text>添加团友</text>
      </view> -->
  </view>
</view>
<view class="bot-btn" @tap="tokaituan">
  <text>再次开团</text>
</view>
</view>
</template>

<script>
import api from "../../../api";
var app = getApp();

export default {
  data() {
    return {
      order_id: "",
      ty: "",
      goods: "",
      tzimg: "",
      tzname: "",
      add_time: "",
      group_need_num: ""
    };
  },

  components: {},
  props: {},

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      order_id: options.id
    });
    this.getDetails();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {},

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {},
  methods: {
    getDetails: function () {
      var that = this;
      app.globalData.request({
        url: api.gzSea.details,
        data: {
          order_id: this.order_id
        },
        header: {
          'content-type': 'application/x-www-form-urlencoded' // 默认值

        },
        method: 'POST',
        success: res => {
          console.log(res);
          this.setData({
            ty: res.tuan_yuan,
            goods: res.goods_message,
            tzimg: res.tuan_zhang.avatar,
            tzname: res.tuan_zhang.nickname,
            add_time: res.end_time,
            group_need_num: res.group_need_num
          });
        }
      });
    },

    tokaituan() {
      var id = this.goods.goods_id;
      console.log(id);
      wx.navigateTo({
        url: '../../packageA/groupdetails/groupdetails?goods_id=' + id
      });
    }

  }
};
</script>
<style>
@import "./spellsuccess.css";
</style>